package com.tools.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.tools.entity.QueryDetail;

@Repository(value="queryDetailMapper")
public interface QueryDetailMapper {

	@Insert("insert into queryDetail(relation,item,compare,value,qid) values(#{relation},#{item},#{compare},#{value},#{query.id})")
	@Options(keyColumn="id",useGeneratedKeys=true)
	int insert(QueryDetail queryDetail);
	
	@Delete("delete from queryDetail where qid=#{query.id}")
	int delete(int qid);
	
	@Update("update queryDetail set relation=#{relation},item=#{item},compare=#{compare},value=#{value},qid=#{query.id} where id=#{id})")
	int update(QueryDetail queryDetail);
}
